import Vue from "vue"
import Router from 'vue-router'
Vue.use(Router)
const originalPush = Router.prototype.push

Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

// import Present from "@/components/Present"
// import Comments from "@/components/Comments"
export default new Router({
    mode:"history",
    scrollBehavior(){
        return {x:0,y:0}
    },
    // afterEach(to,from,next){

    // },
    routes:[
        {
            path:'/',
            name:'Rota',
            component:() => import("@/views/Rotation"),
        },
        {
            path:'/Rankinglist',
            name:'Rankinglist',
            component:() => import("@/views/RankingList"),
        },
        {
            path:'/Classs',
            name:'Classs',
            redirect:"/Class",
            component:() => import("@/views/Classs"),
        },
        {
            path:'/Class',
            name:'Class',
            component:() => import("@/views/Classs"),
        },
        {
            path:'/details',
            name:'details',
            //redirect:"/det",
            component:() => import("@/views/Details"),
            children:[
                {
                    path:'/present',
                    name:'present',
                    //redirect:'/rese',
                    components:{
                        nav:() => import('@/components/Present')
                    }
                },
                {
                    path:'/comments',
                    name:'comments',
                    components:{
                        nav:() => import('@/components/Comments')
                    }
                },
                {
                    path:'/relate',
                    name:'relate',
                    components:{
                        nav:() => import('@/components/Relate')
                    }
                },
            ]
        },
        {
            path:'/usermain',
            name:'usermain',
            component:() => import("@/components/UserMain"),
        },
    ],
})